<template>
  <div class="detail" v-loading="!hospitalDetail?.hosname">
    <div class="top">
      <h3 class="title">{{ hospitalDetail?.hosname }}</h3>
      <div class="level">
        <SvgIcon name="good" width="18px" height="18px" />
        <span>&nbsp;{{ hospitalDetail?.param.hostypeString }}</span>
      </div>
    </div>
    <div class="content">
      <div class="left">
        <img
          :src="`data:image/jpeg;base64,${hospitalDetail?.logoData}`"
          alt="logo"
        />
      </div>
      <div class="right">
        <ul>
          <li>
            <SvgIcon name="address" />
            具体地址：{{ hospitalDetail?.param.fullAddress }}
          </li>
          <li>
            <SvgIcon name="route" />
            规划路线：{{ hospitalDetail?.route }}
          </li>
        </ul>
      </div>
    </div>
    <!-- 介绍 -->
    <div class="introduce">
      <h3 class="title">医院简介</h3>
      <p v-if="hospitalDetail?.intro">
        {{ hospitalDetail?.intro }}
      </p>
      <el-empty v-else description="暂无数据" />
    </div>
  </div>
</template>

<script setup lang="ts" name="Detail">
import useHospitalDetailsStore from '@/store/modules/hospitalDetails'
import { storeToRefs } from 'pinia'

// 获取仓库中的医院相关的数据
const { hospitalDetail } = storeToRefs(useHospitalDetailsStore())
</script>

<style scoped lang="scss">
.detail {
  margin: 20px;
  color: $base-color;
  margin-bottom: 50px;
  .top {
    display: flex;
    align-items: baseline; // 垂直对齐对齐方式
    .title {
      color: $base-active-color;
      font-size: 30px;
      margin-right: 30px;
      font-weight: bold;
    }
    .level {
      display: flex;
      align-items: center;
    }
  }
  .content {
    display: flex;
    .left {
      width: 150px;
      margin-top: 20px;
      margin-right: 20px;
      img {
        width: 150px;
        height: 150px;
        border-radius: 50%;
      }
    }
    .right {
      margin-top: 40px;
      li {
        margin-bottom: 10px;
        line-height: 20px;
      }
    }
  }
  .introduce {
    .title {
      font-size: 18px;
      color: $base-active-color;
      margin-bottom: 10px;
      font-weight: bold;
    }
    p {
      text-indent: 2em; // 首行缩进二字符
      line-height: 26px;
    }
  }
}
</style>
